package com.binyouwei.designpatterns.behavior.visitor;

import java.awt.Rectangle;

/**
 * @author 宾有为
 * Created on 2024/7/15 22:40
 * Social homepage: https://blog.csdn.net/baidu_41616022
 * @desc
 **/
public class VisitorAreaCalculator implements VisitorShapeVisitor{

    @Override
    public void visit(VisitorCircle circle) {
        System.out.println("Circle area: " + Math.PI * circle.getRadius() * circle.getRadius());
    }

    @Override
    public void visit(VisitorRectangle rectangle) {
        System.out.println("Rectangle area: " + rectangle.getWidth() * rectangle.getHeight());
    }
}
